package com.nbsaas.boot.marketing.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "秒杀商品", model = "秒杀商品")
@Entity
@Table(name = "bs_flash_sale_product")
@Comment("秒杀商品表")
public class FlashSaleProduct extends AbstractEntity {

    @Comment("秒杀活动ID")
    @SearchItem(name = "flashSaleId", key = "flashSaleId", label = "秒杀活动ID")
    @FormField(title = "秒杀活动ID", sortNum = "1", grid = true, required = true)
    @Column(nullable = false)
    private Long flashSaleId;

    @Comment("商品ID")
    @SearchItem(name = "productId", key = "productId", label = "商品ID")
    @FormField(title = "商品ID", sortNum = "2", grid = true, required = true)
    @Column(nullable = false)
    private Long productId;

    @Comment("SKU ID")
    @FormField(title = "SKU ID", sortNum = "3", grid = true)
    private Long skuId;

    @Comment("原价")
    @FormField(title = "原价", sortNum = "4", grid = true, type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal originalPrice;

    @Comment("秒杀价")
    @FormField(title = "秒杀价", sortNum = "5", grid = true, type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal flashPrice;

    @Comment("库存限制")
    @FormField(title = "库存限制", sortNum = "6", grid = true, type = InputType.el_input_number)
    private Integer stockLimit;

    @Comment("已售数量")
    @FormField(title = "已售数量", sortNum = "7", grid = true, type = InputType.el_input_number)
    private Integer soldCount;

    @Comment("每人限购数量")
    @FormField(title = "每人限购数量", sortNum = "8", grid = true, type = InputType.el_input_number)
    private Integer perLimit;
} 